Skip to content

Add specifier unique identifier to TIFA and syntactic assertion feedbacks#164

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/add-unique-identifier-for-ff
Draft

Add specifier unique identifier to TIFA and syntactic assertion feedbacks#164
Copilot wants to merge 2 commits into
masterfrom
copilot/add-unique-identifier-for-ff

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 23, 2026

Pedal's Feedback class had a specifier field defined (with documentation) to uniquely identify feedback instances by their conditions — but TIFA and syntactic assertion feedbacks never populated it, making the field useless for those tool categories.

Changes

pedal/tifa/feedbacks.py

All TIFA feedback classes now set self.specifier before calling super().__init__():

  • Name-based feedbacks (variable/function/class): specifier = name — covers unused_variable, initialization_problem, overwritten_variable, read_out_of_scope, recursive_call, incorrect_arity, parameter_type_mismatch, and others
  • Location-based feedbacks (no identifying name): specifier = str(location) — covers action_after_return, unconnected_blocks, type_change_append, etc.
  • incompatible_types: specifier = op_name (the operation description, e.g. "addition")
  • recursive_call: extracts name.name since the caller passes a State object rather than a plain string

pedal/assertions/syntactic.py

  • RequireAssertionFeedback / RejectAssertionFeedback: specifier = code
  • reject_code_regex / require_code_regex: specifier = pattern

tests/test_tifa.py

Added TestSpecifiers with 15 tests verifying specifier values across the main TIFA feedback types:

tifa = pedal.tifa.Tifa()
result = tifa.process_code('a = 0')
assert result.issues['unused_variable'][0].specifier == 'a'

tifa = pedal.tifa.Tifa()
result = tifa.process_code('def f(x: int): return x\nf("hello")')
assert result.issues['parameter_type_mismatch'][0].specifier == 'x'

Copilot AI linked an issue Apr 23, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add unique identifier for all FF Add specifier unique identifier to TIFA and syntactic assertion feedbacks Apr 23, 2026
Copilot AI requested a review from acbart April 23, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Surfacing a "unique identifier" for all FF

2 participants